package com.zy.cloud.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @ClassName: UserConsulController
 * @Description: #TODO
 * @Author: yanzy
 * @Date: 2021/3/2 18:16
 */
@RestController
public class UserConsulController {

    private static final String INVOKE_URL = "http://cloud-provider-server";

    @Resource
    private RestTemplate restTemplate;

    @GetMapping("/user")
    public String getName(String name) {

        return restTemplate.getForObject(INVOKE_URL + "/user?name=" + name, String.class);
    }
}
